package com.itheima.group;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Partitioner;

public class MyPartitioner extends Partitioner<OrderBean, NullWritable> {

    @Override
    public int getPartition(OrderBean orderBean, NullWritable nullWritable, int numReduceTask) {
        String orderId = orderBean.getOrderId();

        return (orderId.hashCode() & Integer.MAX_VALUE) % numReduceTask;
    }
}
